<?php

    if (!function_exists('calculate_payment_amount')) {

        function calculate_payment_amount($reservationSTD, $CI) {

            $CI->load->helper('percent');

            /*
             * Ovdje provjeravamo da li je opcija I ili opcija II
             */

            $CI->firephp->log($reservationSTD);

            $reservation = $reservationSTD->reservation->reservation;

            $CI->firephp->log($reservation);

            $payment_info = array(
                'amount' => 0,
                'FULL_PAYMENT' => FALSE,
            );

            if ($reservation->payment_options == PAYMENT_OPTION_30_70_1 || $reservation->payment_options == PAYMENT_OPTION_30_70_2):

                $payment_info['amount'] = find_percent(30, $reservation->price_total);
                $payment_info['FULL_PAYMENT'] = TRUE;

            elseif ($reservation->payment_options == PAYMENT_OPTION_100):

                $payment_info['amount'] = $reservation->price_total;
                $payment_info['FULL_PAYMENT'] = TRUE;


            else:

                $payment_info['amount'] = 0;
                $payment_info['FULL_PAYMENT'] = FALSE;

            endif;

            return $payment_info;
        }

    }
    